/*
 * @lc app=leetcode.cn id=162 lang=cpp
 *
 * [162] 寻找峰值
 */
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>

using namespace std;
// @lc code=start
class Solution {
public:
    int findPeakElement(vector<int>& nums) {
        int n = nums.size();
        if(n == 1) {
            return 0;
        }
        for(int i = 0;i < n-1;i++) {
            if(nums[i] > nums[i+1]) {
                return i;
            }
        }
        return n-1;
    }
};
// @lc code=end

